package com.tupi.project.ui.activity;

import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;
import android.view.View;

import com.tbruyelle.rxpermissions2.RxPermissions;
import com.tupi.project.R;
import com.tupi.project.base.BaseActivity;
import com.tupi.project.ui.contract.PermissionContract;
import com.tupi.project.ui.presenter.PermissionPresenter;

import butterknife.OnClick;

public class PermissionActivity extends BaseActivity<PermissionPresenter> implements
        PermissionContract.View
{
    @Override
    protected void initInject()
    {
        getActivityComponent().inject(this);
    }
    
    
    @Override
    protected int getLayout()
    {
        return R.layout.activity_permission;
    }
    
    @Override
    protected void initEventAndData()
    {
        
    }
    
    
    @OnClick({R.id.button})
    public void onClick(View view)
    {
        switch (view.getId())
        {
            case R.id.button:
                mPresenter.onClickCheckPermission(new RxPermissions(this));
                break;
        }
    }
    
    @Override
    public void toSettingActivity()
    {
        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setData(Uri.parse("package:" + getPackageName()));
        startActivity(intent);
    }
}
